home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-01-12 | 3.0 KB | 79 lines | [TEXT/ToyS] |
- -- This is a MacWebCam post-process script to FTP the last image
- -- (Image.jpg) to a remote FTP location and saves it as "current.jpg".
- -- This document should be viewed and edited using "Script Editor".
- -- This script starts and terminates a PPP connection if not already
- -- connected
- -- The FTP portion of the script uses a two step process to minimize
- -- the time that a image is unavailable to the http server.
-
- -- Step 1: Get the right PPP
- -- Verify that you have the latest Apple PPP
- -- Install and make sure that "PPP Commands" is in your
- -- "System Folder:Extensions:Scripting Additions" folder.
- -- To test your PPP, create a new script and type "PPP Connect"
- -- and hit "Run."
- -- If you're already connected, you'll get an error. Next, delete
- -- that and type "PPP Disconnect" and hit "Run."
-
- -- Step 2:
-
- -- Open this document from ScriptEditor- save it as "MyFTP Script"
- -- Create a Ram Disk for added efficiency using the "Memory" control
- -- panel. (Or rename file path to suit your needs)
- -- Put an alias of Fetch 3.0.1 in your "Startup Items" folder in your
- -- System Folder. If you have an older version, please upgrade.
- -- Reboot to activate Ram Disk and start Fetch.
- -- Edit the script below, modifying the host, userID, password, and
- -- file names as needed. They have been marked with xxxxxx
-
- -- Step 3:
-
- -- Create a MacWebCam document with the following settings
- -- Set type to jpeg (already default)
- -- Set number of pictures to save to 1
- -- Set image destination folder to your Ram Disk
- -- set file name to Image
- -- Do not set your post process proc yet.
- -- Save your MacWebCam document in your System Folder:Startup items folder.
- -- Do a command-T (take picture now) to take the first picture.
- -- Next: Go to this script editor document and try running the script.
- -- If all goes well, current.jpg should exist on your remote FTP server.
- -- Debug as needed. When working, Quit Script Editor or close
- -- "MyFTP Script".
- -- From MacWebCam, Set Post process script to this document to
- -- "MyFTP Script"
-
-
- try
- -- Find status of PPP connection and store in a variable "origState"
- set origState to PPP status
- -- If not connected, connect to your ISP
- if (state of origState is not "Connected") then
- PPP connect
- end if
-
- -- If we're connected, do the FTP part
- if (state of (PPP status) is "Connected") then
- tell application "Fetch 3.0.1"
- make new transfer window at beginning with properties {hostname:"ftp.xxxxxx.com", userid:"xxxxxxUserName", password:"xxxxxxPassword"}
- put into transfer window "ftp.xxxxxx.com" item alias "RAM Disk:Image.jpg" text format Raw Data binary format Raw Data
- set name of remote file "Image.jpg" to "current.jpg"
- close front window
- end tell
- else
- -- signal FTP error
- -- change this to some error, or take out beep if it bugs you.
- beep
- beep
- end if
-
- PPP disconnect
-
- on error errMsg number errNum
- -- signal PPP or other error
- -- change this to some error, or take out beep if it bugs you.
- beep
- end try
-
-
-